package cn.iocoder.yudao.module.digital.service.cardkeythirdpartyapirecord;

import java.util.*;
import javax.validation.*;

import cn.iocoder.yudao.module.digital.controller.admin.cardkeythirdpartyapirecord.vo.*;
import cn.iocoder.yudao.module.digital.dal.dataobject.cardkeythirdpartyapirecord.CardkeyThirdPartyApiRecordDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.digital.enums.cardkeysecret.CardKeyApiRequestTypeEnum;
import cn.iocoder.yudao.module.digital.service.cardchannel.model.EGiftErrorResponse;
import cn.iocoder.yudao.module.digital.service.cardchannel.model.ListByFailedHttpCodeVO;
import cn.iocoder.yudao.module.digital.service.cardchannel.model.ListByHttpStatusCodesVO;

/**
 * 卡密第三方API请求记录 Service 接口
 *
 * @author 超管
 */
public interface CardkeyThirdPartyApiRecordService {

    /**
     * 创建卡密第三方API请求记录
     *
     * @param createReqVO 创建信息
     * @return 编号
     */
    Long createCardkeyThirdPartyApiRecord(@Valid CardkeyThirdPartyApiRecordSaveReqVO createReqVO);

    /**
     * 更新卡密第三方API请求记录
     *
     * @param updateReqVO 更新信息
     */
    void updateCardkeyThirdPartyApiRecord(@Valid CardkeyThirdPartyApiRecordSaveReqVO updateReqVO);

    /**
     * 删除卡密第三方API请求记录
     *
     * @param id 编号
     */
    void deleteCardkeyThirdPartyApiRecord(Long id);

    /**
     * 获得卡密第三方API请求记录
     *
     * @param id 编号
     * @return 卡密第三方API请求记录
     */
    CardkeyThirdPartyApiRecordDO getCardkeyThirdPartyApiRecord(Long id);

    /**
     * 获得卡密第三方API请求记录分页
     *
     * @param pageReqVO 分页查询
     * @return 卡密第三方API请求记录分页
     */
    PageResult<CardkeyThirdPartyApiRecordDO> getCardkeyThirdPartyApiRecordPage(CardkeyThirdPartyApiRecordPageReqVO pageReqVO);

    int updateById(CardkeyThirdPartyApiRecordDO apiRecordDO);

    CardkeyThirdPartyApiRecordDO getCardkeyThirdPartyApiRecordByRequestIdAndType(CardKeyApiRequestTypeEnum requestType, String requestId);

    PageResult<CardkeyThirdPartyApiRecordDO> listByHttpStatusCodesNotRevert(ListByHttpStatusCodesVO vo);

    PageResult<CardkeyThirdPartyApiRecordDO> listByFailedHttpCodeNotRevert(ListByFailedHttpCodeVO vo);

    //

    Long createApiRecord(CardKeyApiRequestTypeEnum requestType, String orderNo, String productNo, String currencyCode, Integer denomination,
                         String requestId, String url, String requestBody, Map<String, String> requestHeaders,
                         String generateEGiftRequestId);

    void updateApiRecordWithRequestBody(Long apiRecordId, String requestBody);

    void updateApiRecordWithSuccessResponse(Long apiRecordId, String responseBody);

    void updateApiRecordWithErrorResponse(Long apiRecordId, int httpStatusCode, String responseBody, EGiftErrorResponse errorResponse);

    void updateApiRecordToReverseSuccess(Long apiRecordId);

}